package com.sz.biz.logistics.ord.dto;

import com.google.common.collect.Lists;
import com.sz.common.base.constants.RegularConstants;
import com.sz.common.base.utils.StringUtils;
import com.sz.biz.logistics.ord.entity.OrderStatus;
import com.sz.biz.pay.constants.PayStatus;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Function: 定单的Dto  <br>
 * Author: hpeng.wang <br>
 * Date: 2017-03-31 09:50:00
 */
public class OrdOrderDto implements Serializable {
    /**
     * 自增长id
     */
    @ApiModelProperty(hidden = true)
    private Integer id;
    private String orderNo;
    /**
     * 产品的运单编号
     */
    private String waybillNo;
    /**
     * 渠道单号
     */
    private String channelNo;

    /**
     * 客户id
     */
    private Integer customerId;
    private String customerName;
    @NotNull(message = "validate.notnull")
    private Integer cusUserId;
    /**
     * 客户名字,dto做展示
     */
    private String cusUserName;

    /**
     * 货物类型，从sys_dict表中找catalog为biz.cargo.type字段。
     * 例如：文件、普通小包、普通大包、生鲜、电子、电池
     */
    @NotBlank(message = "validate.notnull")
    private String cargoType;

    /**
     * 下单的方式 1、客户平台自己下单 2、代表运营平台代替下单
     */
    private Integer type;

    /**
     * 货物类型名称
     */

    private String cargoTypeName;

    /**
     * 产品的id，引用产品表或服务表的id
     */
    @NotBlank(message = "validate.notnull")
    private String productUid;
    private Integer productId;
    /**
     * 不保存，dto做展示
     */
    private String productName;

    /**
     * 产品code
     */
    private String productCode;

    /**
     * 订单的状态,例如：1、草稿 2、已经提交  等.....
     */
    @NotNull(message = "validate.notnull")
    private OrderStatus orderStatus;

    /**
     * 现结的订单支付状态
     */
    private PayStatus payStatus;

    /**
     * 订单状态的名字
     */
    private String orderStatusName;

    /**
     * 订单支付状态的名字
     */
    private String payStatusName;

    /**
     * 结算方式编号，例如：现结、月结
     */
    private Integer settlementTypeId;
    /**
     * 结算方式编号，例如：现结、月结
     */
    private String settlementTypeName;

    /**
     * 客户填写的货物总重量
     */
    @NotNull(message = "validate.notnull")
    private BigDecimal cusWeight;

    /**
     * 客户填写的货物的重量单位,默认为kg
     */
    @NotBlank(message = "validate.notnull")
    private String cusWeightUnit;

    private String cusWeightUnitName;

    /**计费重*/
    private BigDecimal feeCalcWeight;
    /**计费重单位*/
    private String feeCalcWeightUnit;
    private String feeCalcWeightUnitName;
    /**
     * 实际计费总重量
     */
    private BigDecimal supWeight;

    /**
     * 实际计费货物的重量单位,默认为kg
     */
    private String supWeightUnit;
    private String supWeightUnitName;

    /**
     * 体积重
     */
    private BigDecimal volumeWeight;
    /**
     * 体积重单位
     */
    private String volumeWeightUnit;
    /**
     * 体积重单位名称
     */
    private String volumeWeightUnitName;
    /**
     * 包裹的个数（子订单个数）
     */
    @NotNull(message = "validate.notnull")
    @Range(min = 1, max = 100, message = "validate.number.format.failed")
    private Integer packageNum;

    @NotBlank(message = "validate.notnull")
    private String fromName;

    @Size(max = 30, message = "validate.number.format.length.failed")
    @Pattern(regexp = RegularConstants.REG_PHONE_NULL, message = "validate.phone.format.failed")
    private String fromTelephone;

    @Size(max = 30, message = "validate.number.format.length.failed")
    @Pattern(regexp = RegularConstants.REG_PHONE_NULL, message = "validate.phone.format.failed")
    private String fromPhone;

    /**
     * 发货人的名字
     */
    private String fetchName;

    /**
     * 发货人联系电话
     */
    private String fetchPhone;
    private String fetchTelephone;


    /**
     * 收货人的名字
     */
    @NotBlank(message = "validate.notnull")
    private String toName;
    @Size(max = 30, message = "validate.number.format.length.failed")
    @Pattern(regexp = RegularConstants.REG_PHONE_NULL, message = "validate.phone.format.failed")
    private String toTelephone;
    /**
     * 收货人联系电话
     */
    @Size(max = 30, message = "validate.number.format.length.failed")
    @Pattern(regexp = RegularConstants.REG_PHONE_NULL, message = "validate.phone.format.failed")
    private String toPhone;


    /**
     * 是否被删除 0，未被删除，1已经被删除
     */
    @ApiModelProperty(example = "false")
    private Boolean isDeleted = false;
    /**
     * 是否有效 0，无效，1有效
     */
    @ApiModelProperty(example = "false")
    private Boolean verifiedStatus = false;

    /**
     * 定单是否有效，true：有效 false 无效  默认为true
     */
    @ApiModelProperty(hidden = true)
    private Boolean validFlag;

    /**
     * 客户的外部关联号，客户自定义
     */
    @NotBlank(message = "validate.notnull")
    private String externalNo;

    /**
     * 客户的留言
     */
    private String customerNote;

    private Integer createUserId;
    private String createUserName;
    private String createFullName;

    private Integer lastUpdateUserId;
    private String lastUpdateUserName;
    private String lastUpdateFullName;

    private Date deliveryCargoTime;
    /**
     * 定单的创建时间
     */
    @ApiModelProperty(hidden = true)
    private Date createTime;

    /**
     * 定单的最后更新时间
     */
    @ApiModelProperty(hidden = true)
    private Date lastUpdateTime;
    /**
     * 货物明细
     */
    @NotEmpty(message = "validate.notnull")
    private List<OrdOrderCargoDto> orderCargoDtos = new ArrayList<>();
    /**
     * 子订单
     */
    private List<OrdSubOrderDto> ordSubOrderDtos = new ArrayList<>();
    /**
     * 附加的服务
     */
    private List<OrdOrderAdditionalDto> orderAdditionalDtos = new ArrayList<>();
    private OrdOrderFeeDto orderFeeDto;
    private OrderAddressModel fromAddress = null;
    private OrderAddressModel fetchAddress = null;
    private OrderAddressModel toAddress = null;
    private String smsStatus;
    private String emailStatus;


    private String fromDetail;

    private String toDetail;

    private String fetchDetail;

    /**
     * 是否同步地址 true：同步 false：不同步
     */

    /**
     * 附件
     *
     * @return
     */
    private List<OrdOrderFileDto> fileDtos = Lists.newArrayList();

    /**
     *  add 2017-11 ，附加服务类型中，是否有揽收服务类型.给excel解析中增加。
     */
    private boolean isFetch  ;


    public boolean isFetch() {
        return isFetch;
    }

    public void setFetch(boolean fetch) {
        isFetch = fetch;
    }

    public String getFromDetail() {
        return fromDetail;
    }

    public void setFromDetail(String fromDetail) {
        this.fromDetail = fromDetail;
    }

    public String getToDetail() {
        return toDetail;
    }

    public void setToDetail(String toDetail) {
        this.toDetail = toDetail;
    }

    public String getFetchDetail() {
        return fetchDetail;
    }

    public void setFetchDetail(String fetchDetail) {
        this.fetchDetail = fetchDetail;
    }

    public Boolean getDeleted() {
        return isDeleted;
    }

    public void setDeleted(Boolean deleted) {
        isDeleted = deleted;
    }

    public List<OrdOrderFileDto> getFileDtos() {
        return fileDtos;
    }

    public void setFileDtos(List<OrdOrderFileDto> fileDtos) {
        this.fileDtos = fileDtos;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getWaybillNo() {
        return waybillNo;
    }

    public void setWaybillNo(String waybillNo) {
        this.waybillNo = waybillNo;
    }

    public String getChannelNo() {
        return channelNo;
    }

    public void setChannelNo(String channelNo) {
        this.channelNo = channelNo;
    }

    public Integer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Integer customerId) {
        this.customerId = customerId;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public Integer getCusUserId() {
        return cusUserId;
    }

    public void setCusUserId(Integer cusUserId) {
        this.cusUserId = cusUserId;
    }

    public String getCusUserName() {
        return cusUserName;
    }

    public void setCusUserName(String cusUserName) {
        this.cusUserName = cusUserName;
    }

    public String getCargoType() {
        return cargoType;
    }

    public void setCargoType(String cargoType) {
        this.cargoType = cargoType;
    }

    public String getCargoTypeName() {
        return cargoTypeName;
    }

    public void setCargoTypeName(String cargoTypeName) {
        this.cargoTypeName = cargoTypeName;
    }

    /**
     * 下单的方式 1、客户平台自己下单 2、代表运营平台代替下单
     */
    public Integer getType() {
        return type;
    }

    /**
     * 下单的方式 1、客户平台自己下单 2、代表运营平台代替下单
     */
    public void setType(Integer type) {
        this.type = type;
    }

    public String getProductUid() {
        return productUid;
    }

    public void setProductUid(String productUid) {
        this.productUid = productUid;
    }

    public Integer getProductId() {
        return productId;
    }

    public void setProductId(Integer productId) {
        this.productId = productId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public OrderStatus getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(OrderStatus orderStatus) {
        this.orderStatus = orderStatus;
    }

    public String getOrderStatusName() {
        return orderStatusName;
    }

    public void setOrderStatusName(String orderStatusName) {
        this.orderStatusName = orderStatusName;
    }

    public Integer getSettlementTypeId() {
        return settlementTypeId;
    }

    public void setSettlementTypeId(Integer settlementTypeId) {
        this.settlementTypeId = settlementTypeId;
    }

    public String getSettlementTypeName() {
        return settlementTypeName;
    }

    public void setSettlementTypeName(String settlementTypeName) {
        this.settlementTypeName = settlementTypeName;
    }

    public BigDecimal getCusWeight() {
        return cusWeight;
    }

    public void setCusWeight(BigDecimal cusWeight) {
        this.cusWeight = cusWeight;
    }

    public String getCusWeightUnit() {
        return cusWeightUnit;
    }

    public void setCusWeightUnit(String cusWeightUnit) {
        if (StringUtils.hasLength(cusWeightUnit)) {
            cusWeightUnit = cusWeightUnit.toLowerCase();
        }
        this.cusWeightUnit = cusWeightUnit;
    }

    public String getCusWeightUnitName() {
        return cusWeightUnitName;
    }

    public void setCusWeightUnitName(String cusWeightUnitName) {
        this.cusWeightUnitName = cusWeightUnitName;
    }

    public BigDecimal getFeeCalcWeight() {
        return feeCalcWeight;
    }

    public void setFeeCalcWeight(BigDecimal feeCalcWeight) {
        this.feeCalcWeight = feeCalcWeight;
    }

    public String getFeeCalcWeightUnit() {
        return feeCalcWeightUnit;
    }

    public void setFeeCalcWeightUnit(String feeCalcWeightUnit) {
        this.feeCalcWeightUnit = feeCalcWeightUnit;
    }

    public String getFeeCalcWeightUnitName() {
        return feeCalcWeightUnitName;
    }

    public void setFeeCalcWeightUnitName(String feeCalcWeightUnitName) {
        this.feeCalcWeightUnitName = feeCalcWeightUnitName;
    }

    public BigDecimal getSupWeight() {
        return supWeight;
    }

    public void setSupWeight(BigDecimal supWeight) {
        this.supWeight = supWeight;
    }

    public String getSupWeightUnit() {
        return supWeightUnit;
    }

    public void setSupWeightUnit(String supWeightUnit) {
        if (StringUtils.hasLength(supWeightUnit)) {
            supWeightUnit = supWeightUnit.toLowerCase();
        }
        this.supWeightUnit = supWeightUnit;
    }


    public String getSupWeightUnitName() {
        return supWeightUnitName;
    }

    public void setSupWeightUnitName(String supWeightUnitName) {
        this.supWeightUnitName = supWeightUnitName;
    }

    public BigDecimal getVolumeWeight() {
        return volumeWeight;
    }

    public void setVolumeWeight(BigDecimal volumeWeight) {
        this.volumeWeight = volumeWeight;
    }

    public String getVolumeWeightUnit() {
        return volumeWeightUnit;
    }

    public void setVolumeWeightUnit(String volumeWeightUnit) {
        this.volumeWeightUnit = volumeWeightUnit;
    }

    public String getVolumeWeightUnitName() {
        return volumeWeightUnitName;
    }

    public void setVolumeWeightUnitName(String volumeWeightUnitName) {
        this.volumeWeightUnitName = volumeWeightUnitName;
    }

    public Integer getPackageNum() {
        return packageNum;
    }

    public void setPackageNum(Integer packageNum) {
        this.packageNum = packageNum;
    }

    public String getFromName() {
        return fromName;
    }

    public void setFromName(String fromName) {
        this.fromName = fromName;
    }

    public String getFromTelephone() {
        return fromTelephone;
    }

    public void setFromTelephone(String fromTelephone) {
        this.fromTelephone = fromTelephone;
    }

    public String getFromPhone() {
        return fromPhone;
    }

    public void setFromPhone(String fromPhone) {
        this.fromPhone = fromPhone;
    }


    public String getFetchName() {
        return fetchName;
    }

    public void setFetchName(String fetchName) {
        this.fetchName = fetchName;
    }

    public String getFetchTelephone() {
        return fetchTelephone;
    }

    public void setFetchTelephone(String fetchTelephone) {
        this.fetchTelephone = fetchTelephone;
    }

    public String getFetchPhone() {
        return fetchPhone;
    }

    public void setFetchPhone(String fetchPhone) {
        this.fetchPhone = fetchPhone;
    }


    public String getToName() {
        return toName;
    }

    public void setToName(String toName) {
        this.toName = toName;
    }

    public String getToTelephone() {
        return toTelephone;
    }

    public void setToTelephone(String toTelephone) {
        this.toTelephone = toTelephone;
    }

    public String getToPhone() {
        return toPhone;
    }

    public void setToPhone(String toPhone) {
        this.toPhone = toPhone;
    }

    public Boolean getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Boolean deleted) {
        isDeleted = deleted;
    }

    public Boolean getValidFlag() {
        return validFlag;
    }

    public void setValidFlag(Boolean validFlag) {
        this.validFlag = validFlag;
    }

    public String getExternalNo() {
        return externalNo;
    }

    public void setExternalNo(String externalNo) {
        this.externalNo = externalNo;
    }

    public String getCustomerNote() {
        return customerNote;
    }

    public void setCustomerNote(String customerNote) {
        this.customerNote = customerNote;
    }


    public Integer getCreateUserId() {
        return createUserId;
    }

    public void setCreateUserId(Integer createUserId) {
        this.createUserId = createUserId;
    }

    public String getCreateUserName() {
        return createUserName;
    }

    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }

    public String getCreateFullName() {
        return createFullName;
    }

    public void setCreateFullName(String createFullName) {
        this.createFullName = createFullName;
    }

    public Integer getLastUpdateUserId() {
        return lastUpdateUserId;
    }

    public void setLastUpdateUserId(Integer lastUpdateUserId) {
        this.lastUpdateUserId = lastUpdateUserId;
    }

    public String getLastUpdateUserName() {
        return lastUpdateUserName;
    }

    public void setLastUpdateUserName(String lastUpdateUserName) {
        this.lastUpdateUserName = lastUpdateUserName;
    }

    public String getLastUpdateFullName() {
        return lastUpdateFullName;
    }

    public void setLastUpdateFullName(String lastUpdateFullName) {
        this.lastUpdateFullName = lastUpdateFullName;
    }

    public Date getDeliveryCargoTime() {
        return deliveryCargoTime;
    }

    public void setDeliveryCargoTime(Date deliveryCargoTime) {
        this.deliveryCargoTime = deliveryCargoTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(Date lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }


    public OrderAddressModel getFromAddress() {
        return fromAddress;
    }

    public void setFromAddress(OrderAddressModel fromAddress) {
        this.fromAddress = fromAddress;
    }

    public OrderAddressModel getFetchAddress() {
        return fetchAddress;
    }

    public void setFetchAddress(OrderAddressModel fetchAddress) {
        this.fetchAddress = fetchAddress;
    }

    public OrderAddressModel getToAddress() {
        return toAddress;
    }

    public void setToAddress(OrderAddressModel toAddress) {
        this.toAddress = toAddress;
    }

    public List<OrdOrderCargoDto> getOrderCargoDtos() {
        return orderCargoDtos;
    }

    public void setOrderCargoDtos(List<OrdOrderCargoDto> orderCargoDtos) {
        this.orderCargoDtos = orderCargoDtos;
    }

    public List<OrdSubOrderDto> getOrdSubOrderDtos() {
        return ordSubOrderDtos;
    }

    public void setOrdSubOrderDtos(List<OrdSubOrderDto> ordSubOrderDtos) {
        this.ordSubOrderDtos = ordSubOrderDtos;
    }

    public List<OrdOrderAdditionalDto> getOrderAdditionalDtos() {
        return orderAdditionalDtos;
    }

    public void setOrderAdditionalDtos(List<OrdOrderAdditionalDto> orderAdditionalDtos) {
        this.orderAdditionalDtos = orderAdditionalDtos;
    }

    public OrdOrderFeeDto getOrderFeeDto() {
        return orderFeeDto;
    }

    public void setOrderFeeDto(OrdOrderFeeDto orderFeeDto) {
        this.orderFeeDto = orderFeeDto;
    }

    public void addCargoDto(OrdOrderCargoDto ordOrderCargoDto) {
        orderCargoDtos.add(ordOrderCargoDto);
    }

    public void addSubOrderDto(OrdSubOrderDto ordSubOrderDto) {
        ordSubOrderDtos.add(ordSubOrderDto);
    }

    public void addOrderAdditionalDto(OrdOrderAdditionalDto orderAdditionalDto) {
        orderAdditionalDtos.add(orderAdditionalDto);
    }

    public String getSmsStatus() {
        return smsStatus;
    }

    public void setSmsStatus(String smsStatus) {
        this.smsStatus = smsStatus;
    }

    public String getEmailStatus() {
        return emailStatus;
    }

    public void setEmailStatus(String emailStatus) {
        this.emailStatus = emailStatus;
    }


    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

    public PayStatus getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(PayStatus payStatus) {
        this.payStatus = payStatus;
    }

    public String getPayStatusName() {
        return payStatusName;
    }

    public void setPayStatusName(String payStatusName) {
        this.payStatusName = payStatusName;
    }

    public Boolean getVerifiedStatus() {
        return verifiedStatus;
    }

    public void setVerifiedStatus(Boolean verifiedStatus) {
        this.verifiedStatus = verifiedStatus;
    }
}